package ledutil

import (
	"smartconn.cc/liugen/led"
)

var led1 led.LED
var led2 led.LED
var running bool

func init() {
	led1 = led.NewLED("fun_led0", "readingangel") // red
	led2 = led.NewLED("fun_led1", "readingangel")
	running = false
}

// Close close
func Close() {
	led1.SetBrightness(0)
	led2.SetBrightness(0)
	running = false
}

// Red red
func Red() {
	led1.SetBrightness(0)
	led2.SetBrightness(1)
}

// Green green
func Green() {
	led1.SetBrightness(1)
	led2.SetBrightness(0)
}

// Yellow yellow
func Yellow() {
	led1.SetBrightness(1)
	led2.SetBrightness(1)
}

// Flicker flicker
func Flicker() {
	led1.SetBrightness(1)
	led2.SetBrightness(1)
	// running = true
	// for running {
	// 	led1.SetBrightness(1)
	// 	time.After(time.Millisecond * 500)
	// 	if !running {
	// 		return
	// 	}
	// 	led1.SetBrightness(0)
	// 	time.After(time.Millisecond * 500)
	// }
}
